import os
from celery import Celery

# 获取Redis配置
redis_url = os.environ.get('REDIS_URL', 'redis://localhost:6379/0')

# 创建Celery实例
celery = Celery(
    'vulnerability_scanner',
    broker=redis_url,
    backend=redis_url,
    include=['app.services.scan_service']
)

# 配置Celery
celery.conf.update(
    result_expires=3600,
    task_serializer='json',
    result_serializer='json',
    accept_content=['json'],
    timezone='Asia/Shanghai',
    enable_utc=True,
)

if __name__ == '__main__':
    celery.start()